package com.neuedu.studentmanage.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neuedu.studentmanage.entity.Pager;
import com.neuedu.studentmanage.entity.Result;
import com.neuedu.studentmanage.entity.TehGrade;
import com.neuedu.studentmanage.mapper.TehGradeMapper;
import com.neuedu.studentmanage.service.TehGradeService;

@Service
@Transactional
public class TehGradeServiceImpl implements TehGradeService {

	@Autowired
	private TehGradeMapper tehGradeMapper;

	@Override
	public List<TehGrade> findListByPager(Pager<TehGrade> pager) {
		return tehGradeMapper.findListByPager(pager);
	}

	@Override
	public Integer findTotalByPager(Pager<TehGrade> pager) {
		return tehGradeMapper.findTotalByPager(pager);
	}

	@Override
	public Result add(TehGrade object) {
		Result result = new Result(false, "新增教师等级信息失败！");
		boolean ret = tehGradeMapper.add(object);
		if (ret) {
			result = new Result(true, "新增教师等级信息成功！");
		}
		return result;
	}

	@Override
	public Result edit(TehGrade object) {
		Result result = new Result(false, "修改教师等级信息失败！");
		boolean ret = tehGradeMapper.edit(object);
		if (ret) {
			result = new Result(true, "修改教师等级信息成功！");
		}
		return result;
	}

	@Override
	public Result deleteByIds(List<TehGrade> ids) {
		Result result = new Result(false, "删除教师等级信息失败！");
		boolean ret = tehGradeMapper.deleteByIds(ids);
		if (ret) {
			result = new Result(true, "删除教师等级信息成功！");
		}
		return result;
	}

	@Override
	public List<TehGrade> findAll() {
		return tehGradeMapper.findAll();
	}

}
